#### 27.9.2 Ada Exception gdb/mi Catchpoints

The following gdb/mi commands can be used to create catchpoints that stop the execution when Ada exceptions are being raised.

#### The `-catch-assert` Command

##### Synopsis

          -catch-assert [ -c condition] [ -d ] [ -t ]

Add a catchpoint for failed Ada assertions.

The possible optional parameters for this command are:

``-c condition`'
  Make the catchpoint conditional on condition.
``-d`'
  Create a disabled catchpoint.
``-t`'
  Create a temporary catchpoint.

##### gdb Command

The corresponding gdb command is ``catch assert`'.

##### Example

         -catch-assert
         ^done,bkptno="5",bkpt={number="5",type="breakpoint",disp="keep",
         enabled="y",addr="0x0000000000404888",what="failed Ada assertions",
         thread-groups=["i1"],times="0",
         original-location="__gnat_debug_raise_assert_failure"}
         (gdb)

#### The `-catch-exception` Command

##### Synopsis

          -catch-exception [ -c condition] [ -d ] [ -e exception-name ]
             [ -t ] [ -u ]

Add a catchpoint stopping when Ada exceptions are raised. By default, the command stops the program when any Ada exception gets raised. But it is also possible, by using some of the optional parameters described below, to create more selective catchpoints.

The possible optional parameters for this command are:

``-c condition`'
  Make the catchpoint conditional on condition.
``-d`'
  Create a disabled catchpoint.
``-e exception-name`'
  Only stop when exception-name is raised. This option cannot be used combined with ``-u`'.
``-t`'
  Create a temporary catchpoint.
``-u`'
  Stop only when an unhandled exception gets raised. This option cannot be used combined with ``-e`'.

##### gdb Command

The corresponding gdb commands are ``catch exception`' and ``catch exception unhandled`'.

##### Example

         -catch-exception -e Program_Error
         ^done,bkptno="4",bkpt={number="4",type="breakpoint",disp="keep",
         enabled="y",addr="0x0000000000404874",
         what="`Program_Error' Ada exception", thread-groups=["i1"],
         times="0",original-location="__gnat_debug_raise_exception"}
         (gdb)